# -*- coding: utf-8 -*-
from django.utils import unittest
from django.test.client import Client
 
class PRTestCase(unittest.TestCase):
    def setUp(self):
        self.client = Client()

    def testSpeaking(self):
        #c.get('/customers/details/', {'name': 'fred', 'age': 7})
        #c.post('/login/', {'name': 'fred', 'passwd': 'secret'})
        self.client.login(username='cleo', password='cleo')
        
        for letter in 'Python':        
            response = self.client.post('/warehouse/pr/add',{
                                                             #'PR_Use':'测试 '+letter,
                                                             #'PR_Adult_User':'5',
                                                             'PR_Description':'备注  ' + letter})
            self.assertEqual(response.status_code, 200)
        #self.assertEqual(len(response.context['customers']), 5)
        
    
class SimpleTest(unittest.TestCase):
    def setUp(self):
        # Every test needs a client.
        self.client = Client()

    def test_details(self):
        # Issue a GET request.
        response = self.client.get('/customer/details/')

        # Check that the response is 200 OK.
        self.assertEqual(response.status_code, 200)

        # Check that the rendered context contains 5 customers.
        self.assertEqual(len(response.context['customers']), 5)
        
        self.assertEqual(2, 1)
         
#        >>> c = Client()
#        >>> f = open('wishlist.doc')
#        >>> c.post('/customers/wishes/', {'name': 'fred', 'attachment': f})
#        >>> f.close()